package com.hongtao3.hsync.ui;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JTabbedPane;
import javax.swing.SwingConstants;

import com.hongtao3.hsync.Main;
import com.hongtao3.hsync.vo.Server;


public class ServerConfigDialog extends JDialog {
  private static final long serialVersionUID = 1L;

  public ServerConfigDialog(JFrame f,String s){
	  super(f,s,true);
	  init();
	  setResizable(false);
	  validate();
	  setVisible(true);
	  setIconImage(Main.getTrayImage());
  }
  
  private void init(){
	 setBounds(100, 100, 450, 250);
	 tabbedPane=new JTabbedPane(SwingConstants.LEFT);
	 Server default_server=new Server("default","/home/duwei/Desktop/vala","http://127.0.0.1/hsync/","/home/duwei/Desktop/tmp","user01","psw01");
	 addNewTable(default_server);
	 add(tabbedPane);
  }
  
  public void addNewTable(Server server){
	  tabbedPane.add(server.getAlias(),new ServerConfigPanel(this,server));
	  tabbedPane.setSelectedIndex(tabbedPane.getTabCount()-1);
  }
  
  public static void main(String[] args){
	 new ServerConfigDialog(null, "default");
  }
  
  private JTabbedPane tabbedPane;
}
